package com.hsb.seckill.config;

import com.hsb.seckill.entity.User;

import javax.jws.soap.SOAPBinding;

/**
 *  将user设置到线程ThreadLocal中
 */
public class UserContent {

    private static ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    //设置user到当前线程中
    public static void setUser(User user){
        userThreadLocal.set(user);
    }

    // 获取当前线程的user
    public static User getUser(){
        return userThreadLocal.get();
    }
}
